package com.hzncc.flowable_diboot.flowable.servicetask.payment;

import com.diboot.core.util.ContextHolder;

import com.hzncc.flowable_diboot.payment.service.PaymentContractService;
import com.hzncc.flowable_diboot.payment.service.impl.PaymentContractServiceImpl;

import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Service;

@Service
public class CancelPaymentContract implements JavaDelegate {
    @Override
    public void execute(DelegateExecution execution) {

        PaymentContractService paymentContractService = ContextHolder.getBean(PaymentContractServiceImpl.class);

        String paymentContractId = (String) execution.getVariable("paymentContractId");
        paymentContractService.revokePaymentContract(paymentContractId);
        paymentContractService.updatePaymentContractStatus(paymentContractId,"6");
    }
}
